//
//  HPViewModel.m
//  Toyohu
//
//  Created by GuoPeng on 16/4/24.
//  Copyright © 2016年 celia. All rights reserved.
//

#import "HPViewModel.h"

#import "HomePageDataModels.h"
#import "LoginManager.h"

@implementation HPViewModel

- (void)getData:(Success)successBlock error:(Error)error
{

    [GPAFNetworking3 get:[NSString stringWithFormat:@"%@?pId=%@",GetTodayInfo,[[LoginManager shareLoginManager] getPid]] progress:^(NSProgress * _Nonnull progress) {
        
    } success:^(id  _Nonnull responseObject) {
        NSLog(@"%@",responseObject);
        
        HPHomePageModel *hModel = [[HPHomePageModel alloc] initWithDictionary:responseObject];
        if (hModel.code == 1) {
            self.msg = hModel.msg;
            successBlock();
            
        } else {
            error([NSString stringWithFormat:@"%@",hModel.msg]);
        }
    } failure:^(NSString * _Nonnull errorLD) {
        error(errorLD);
    }];
    
}


@end
